import React, { Component } from 'react';
import "../../../styles/Index/Home/Seckill.scss"
import {seckill} from "../../../api/index"

import Timer from "./Timer"

class Seckill extends Component {
    constructor(props){
        super(props);
        this.state = {
            goodlist:[]
        }
    }
    async componentDidMount(){
        var res = await seckill();
        // console.log(res.data.data);
        this.setState({goodlist:res.data.data})
    }
    render() {
        return (
            <div className='seckill'>
                <div className="top">
                    <div className="left">
                        <div className="title">嗨购秒杀</div>
                        <div className="time">12点场</div>
                        <div className="timer">
                            <Timer />
                        </div>
                    </div>
                    <div className="right">
                        <p>爆款轮番秒</p>
                        <div>＞</div>
                    </div>
                </div>
                <div className="bottom">
                    {
                        this.state.goodlist.map((item,index)=>{
                            return (
                                <div className="item" key={index}>
                                    <div className="pic">
                                        <img src={item.img1} alt="" />
                                    </div>
                                    <div className="price">￥{item.originprice}</div>
                                </div>
                            )
                        })
                    }
                </div>
            </div>
        );
    }
}

export default Seckill;